<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>旋转的视差</title>
    <style>
        .container {
            width: 300px;
            height: 300px;
            margin: 0 auto;
            margin-top: 100px;
            display: grid;
            grid-template-columns: repeat(3, 1fr) ;
            grid-template-rows: repeat(3, 1fr);
            grid-template:
                'A A B'
                'C D B'
                'C E E';
            gap: 5px;
        }

        .item {
            /* 图片居中 */
            display: flex;
            justify-content: center;
            align-items: center;
            overflow: hidden;
            border: 2px solid;
        }

        .item img {
            /* 将图片放大 */
            width: 260%;
            height: 260%;
            object-fit: cover;
        }

        .item:nth-child(1) {
            grid-area: A;
        }

        .item:nth-child(2) {
            grid-area: B;
        }

        .item:nth-child(3) {
            grid-area: C;
        }

        .item:nth-child(4) {
            grid-area: D;
        }

        .item:nth-child(5) {
            grid-area: E;
        }

        .container {
            --r: 360deg;
        }

        .item img {
            --r: -360deg;
        }
        .container,.item img {
            animation: rotation 10s linear infinite;
        }
        @keyframes rotation {
            to {
                transform: rotate(var(--r));
            }
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="item">
            <img src="https://picsum.photos/200/300?1" alt="" />
        </div>
        <div class="item">
            <img src="https://picsum.photos/200/300?2" alt="" />
        </div>
        <div class="item">
            <img src="https://picsum.photos/200/300?3" alt="" />
        </div>
        <div class="item">
            <img src="https://picsum.photos/200/300?4" alt="" />
        </div>
        <div class="item">
            <img src="https://picsum.photos/200/300?5" alt="" />
        </div>
    </div>
</body>

</html>